package com.asm.DBloader;

import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

public class ASM_fGroupDS 
{
	private SQLiteDatabase dB;
	private ASM_DB dbHelper;
	Context context;
	
	public ASM_fGroupDS(Context context) 
	{
		this.context = context;
		dbHelper  = new ASM_DB(context);
		
	}
	
	public void open() throws SQLException
	{
		dB = dbHelper.getWritableDatabase();
	}
	
	public int Create(ASM_fGroup det) 
	{
		
		int count =0;
		
		if(dB == null){
			open();
		}else if(!dB.isOpen()){
			open();
		}
		
		
		ContentValues values = new ContentValues();
		
		values.put(ASM_DB.asmFGroup_GroupCode, det.getAsmFGroup_GroupCode());
		values.put(ASM_DB.asmFGroup_GroupName, det.getAsmFGroup_GroupName());
			
		count = (int) dB.insert(ASM_DB.ASM_FGROUP, null, values);

		dB.close();
		return count;
		
	}

}
